package org.mapdroid.data.adt;

import java.util.LinkedList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.android.maps.GeoPoint;

public class Restaurant extends MdService{
	//Constructor with parameters
	public Restaurant(String name, String address, String phoneNumber, String description, int photo, String link, GeoPoint position){
		super(name, address, phoneNumber, description, photo, link, MdService.RESTAURANT, position);
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		dest.writeString(this.name);
		dest.writeString(this.address);
		dest.writeString(this.phoneNumber);
		dest.writeString(this.description);
		dest.writeInt(this.photo);
		dest.writeList(this.gallery);
		dest.writeString(this.link);
		dest.writeDouble(this.position.getLatitudeE6());
		dest.writeDouble(this.position.getLongitudeE6());
	}
	
	public static final Parcelable.Creator<Restaurant> CREATOR
			= new Parcelable.Creator<Restaurant>(){
		@Override
		public Restaurant createFromParcel(Parcel in) {
			String name = in.readString();
			String address = in.readString();
			String phone = in.readString();
			String description = in.readString();
			int photo = in.readInt();
			List<Integer> outVal = new LinkedList<Integer>();
			in.readList(outVal, getClass().getClassLoader());
			String link = in.readString();
			GeoPoint point = new GeoPoint((int)in.readDouble(), (int)in.readDouble());
			
			return new Restaurant(name, address, phone, description, photo, link, point);
		}

		@Override
		public Restaurant[] newArray(int size) {
			return new Restaurant[size];
		}
	};
}
